package com.ecc.auth.dao;

import java.util.List;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.ecc.auth.pojo.MenuDO;


@Mapper
public interface MenuMapper {
	
	 /**
    *
    * @mbggenerated 2018-06-12
    */
   int deleteByPrimaryKey(Long id);

   /**
    *
    * @mbggenerated 2018-06-12
    */
   int insert(MenuDO record);

   /**
    *
    * @mbggenerated 2018-06-12
    */
   int insertSelective(MenuDO record);

   /**
    *
    * @mbggenerated 2018-06-12
    */
   MenuDO selectByPrimaryKey(Long id);

   /**
    *
    * @mbggenerated 2018-06-12
    */
   int updateByPrimaryKeySelective(MenuDO record);

   /**
    *
    * @mbggenerated 2018-06-12
    */
   int updateByPrimaryKey(MenuDO record);
	


	List<MenuDO> listMenuByUserId(Long id);

	@Select("select m.perms from sys_menu m left join sys_role_menu rm on m.menu_id = rm.menu_id left join sys_user_role ur on rm.role_id = ur.role_id where ur.user_id = #{id} ")
	List<String> listUserPerms(Long id);
	
	@Select("SELECT	DISTINCT m.perms FROM sys_menu m")
	List<String> listUserPermsSuper();

	List<MenuDO> listMenu();

}
